//
//  CellTieZi.m
//  SeeTheWorld
//
//  Created by dllo on 16/3/3.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CellTieZi.h"
#import "PCH.pch"
#import "ModelTieZi.h"
#import <UIImageView+WebCache.h>


@interface CellTieZi ()

@property (nonatomic, retain)UILabel *labelOfTitle;
@property (nonatomic, retain)UILabel *labelOfUsername;
@property (nonatomic, retain)UILabel *labelOfReplys;
@property (nonatomic, retain)UILabel *labelOfViews;
@property (nonatomic, retain)UIImageView *imageOfYanJing;
@property (nonatomic, retain)UIImageView *imageOfPingLun;

@end

@implementation CellTieZi

- (void)dealloc {
    [_labelOfReplys release];
    [_labelOfTitle release];
    [_labelOfUsername release];
    [_labelOfViews release];
    [_imageOfPingLun release];
    [_imageOfYanJing release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
        
    }
    
    return self;
    
}

- (void)createSubviews {
    
    self.labelOfTitle = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfTitle];
    [_labelOfTitle release];
    self.labelOfTitle.numberOfLines = 2;
    self.labelOfTitle.font = [UIFont systemFontOfSize:16];
    self.labelOfTitle.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);
    
    self.labelOfUsername = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfUsername];
    [_labelOfUsername release];
    self.labelOfUsername.font = [UIFont systemFontOfSize:15];
    self.labelOfUsername.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

    self.labelOfReplys = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfReplys];
    [_labelOfReplys release];
    self.labelOfReplys.font = [UIFont systemFontOfSize:15];
    self.labelOfReplys.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);
    
    self.labelOfViews = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfViews];
    [_labelOfViews release];
    self.labelOfViews.font = [UIFont systemFontOfSize:15];
    self.labelOfViews.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);
    
    self.imageOfPingLun = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"PingLun1"]];
    [self.contentView addSubview:self.imageOfPingLun];
    [_imageOfPingLun release];
    
    self.imageOfYanJing = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"YanJing1"]];
    [self.contentView addSubview:self.imageOfYanJing];
    [_imageOfYanJing release];

    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.labelOfTitle.frame = CGRectMake(10, 10, scWIDTH - 20, (scHEIGHT - 30) / 2 + 10);
    self.labelOfUsername.frame = CGRectMake(10, scHEIGHT - 35, scWIDTH / 4 + 30, (scHEIGHT - 30) / 2);
    self.imageOfYanJing.frame = CGRectMake(10 + scWIDTH / 4 + 30 + 20, scHEIGHT - 27, 20, 20);
    self.labelOfViews.frame = CGRectMake(10 + scWIDTH / 4 + 30 + 20 + 20 + 5, scHEIGHT - 27, 50, 20);
    self.imageOfPingLun.frame = CGRectMake(10 + scWIDTH / 4 + 30 + 20 + 20 + 5 + 50 + 10, scHEIGHT - 27, 20, 20);
    self.labelOfReplys.frame = CGRectMake(10 + scWIDTH / 4 + 30 + 20 + 20 + 5 + 50 + 10 + 20 + 5, scHEIGHT - 27, 50, 20);
}

- (void)passModel:(ModelTieZi *)model {
    
    self.labelOfTitle.text = model.title;
    self.labelOfUsername.text = model.username;
    self.labelOfViews.text = model.views;
    self.labelOfReplys.text = model.replys;
    
}



@end
